<template>
  <div class="about">
    <button @click="$router.back()">跳转到首页</button>
    <button @click="$router.push({path:'/about',query:{id:5}})">跳转到下一个</button>
  </div>
</template>
<script>
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router';
import { useRoute } from 'vue-router'
export default {
  setup(props) {
    const route = useRoute();
    let id = route.query.id;
    console.log(id);
    onBeforeRouteUpdate((to,from)=>{
      console.log(to);
      console.log(from);
    })
  }
}
</script>